﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BitTorrentSharp.Peers
{
	/// <summary>
	/// Represent as a message send between peers.
	/// </summary>
	public abstract class PeerMessage
	{
		/// <summary>
		/// When ovrrided by a derived class, it is used to get all the bytes of this message.
		/// </summary>
		/// <remarks>If this message has no data, this method will return a empty array.</remarks>
		/// <returns>The byte sequence of this message.</returns>
		protected abstract byte[] GetBytesCore();

		/// <summary>
		/// Get all bytes for this message.
		/// </summary>
		/// <returns>The byte sequence of this message.</returns>
		public byte[] GetBytes()
		{
			return this.GetBytesCore();
		}
	}
}
